package cn.supermaster.management.web.controller.system;


import cn.supermaster.management.common.controller.BaseController;
import cn.supermaster.management.web.service.system.ISRoleService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * All rights Reserved, Designed By www.super-bytecode.com
 *
 * @ProjectName: supermaster-management
 * @Package: cn.supermaster.management.web.rest.system
 * @ClassName: SystemRoleRestController
 * @Description: [角色信息Controller]
 * <p> </p>
 * @Author: [Lance Ting]
 * @Date: 2021/1/11 23:12
 * @Version: V1.0
 * @Copyright: 2021 www.super-bytecode.comn Inc. All rights reserved.
 * TODO: 注意,本文件Lance Ting所作,如果转载或使用请标明具体出处!
 **/
@Controller
@RequestMapping("/system/role")
public class SystemRoleController extends BaseController {

    @Autowired
    private ISRoleService roleService;

    @RequiresPermissions("system:role:view")
    @GetMapping()
    public String skipRoleIndexHtml() {
        return roleService.skipRoleIndexHtml();
    }

    /**
     * 新增角色
     */
    @GetMapping("/add")
    public String skipAddRoleHtml() {
        return roleService.skipAddRoleHtml();
    }

    /**
     * 修改角色
     */
    @GetMapping("/edit/{roleId}")
    public String edit(@PathVariable("roleId") Long roleId, ModelMap modelMap) {
        return roleService.skipModifyRoleHtml(modelMap, roleId);
    }

    /**
     * 角色分配数据权限
     */
    @GetMapping("/authDataScope/{roleId}")
    public String skipAuthDataScopeHtml(@PathVariable("roleId") Long roleId, ModelMap modelMap) {
        return roleService.skipAuthDataScopeHtml(modelMap, roleId);
    }

    /**
     * 选择菜单树
     */
    @GetMapping("/selectMenuTree")
    public String skipSelectMenuTreeHtml() {
        return roleService.skipSelectMenuTreeHtml();
    }

    /**
     * 分配用户
     */
    @RequiresPermissions("system:role:edit")
    @GetMapping("/authUser/{roleId}")
    public String skipAuthUserHtml(@PathVariable("roleId") Long roleId, ModelMap modelMap) {
        return roleService.skipAuthUserHtml(modelMap, roleId);
    }

    /**
     * 选择用户
     */
    @GetMapping("/authUser/selectUser/{roleId}")
    public String skipSelectedUserHtml(@PathVariable("roleId") Long roleId, ModelMap modelMap) {
        return roleService.skipSelectedUserHtml(modelMap, roleId);
    }

}